package com.primb.bench.project.setting.activity;

import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.primb.baselibs.view.AutoToolbar;
import com.primb.bench.R;
import com.primb.bench.base.SwipeBaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author Chen
 * @date 2017/10/26
 * 功能描述：
 */

public class HelpActivity extends SwipeBaseActivity {
    @BindView(R.id.title_bar)
    TextView titleBar;
    @BindView(R.id.tool_bar)
    AutoToolbar toolBar;
    @BindView(R.id.iv_app_icon)
    ImageView ivAppIcon;
    @BindView(R.id.tv_help_content)
    TextView tvContent;
    private boolean isHelp;

    @Override
    protected int onBaseLayoutId(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_help;
    }

    @Override
    protected void onBaseIntent() {
        isHelp = getIntent().getBooleanExtra("isHelp", true);
    }

    @Override
    protected void onBaseBindView() {
        toolBar.setNavigationOnClickListener(v -> HelpActivity.this.finish());
        if (isHelp) {
            titleBar.setText("问题反馈");
            ivAppIcon.setBackgroundResource(R.mipmap.ic_phone);
            tvContent.setText("请联系：124325435，进行反馈");
        } else {
            titleBar.setText("关于系统");
            ivAppIcon.setBackgroundResource(R.mipmap.ic_launcher);
            String versionName = null;
            try {
                versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
            } catch (PackageManager.NameNotFoundException e) {
                versionName = "1.0";
            }
            tvContent.setText("产 品 定 价 系 统\n V" + versionName);
        }
    }

    @Override
    protected void onLoadData() {

    }
}
